package collectionTest;

import java.util.Comparator;
import java.util.TreeMap;

public class TreeMapTest {
    public static void main(String[] args) {
        TreeMap<Student,String> treeMap = new TreeMap<>((o1,o2)-> {

                int n1 = o1.getName().compareTo(o2.getName());
                int n2 = o1.getAge()- o2.getAge();
                return n1==0?n2:n1;

        });

        treeMap.put(new Student("zhangsan",19),"北京");
        treeMap.put(new Student("lisi",19),"上海");
        treeMap.put(new Student("zhangsan",20),"深圳");
        System.out.println(treeMap.toString());
    }

    public int calculator(){
        return 0;
    }
}
